package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.blrs.domain.ProjectImplementation;
import com.blrs.domain.dto.ProjectProcessInfoDTO;
import com.blrs.domain.vo.ContractPaymentMethodVo;
import com.blrs.service.project.implementation.IProjectImplementationService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;

import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 项目实施Controller
 * 
 * @author guobin
 * @date 2025-01-10
 */
@RestController
@RequestMapping("/project/implementation")
public class ProjectImplementationController extends BaseController
{
    @Autowired
    private IProjectImplementationService projectImplementationService;

    /**
     * 查询项目实施列表
     */
    //@PreAuthorize("@ss.hasPermi('brls:implementation:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProjectImplementation projectImplementation)
    {
        startPage();
        List<ProjectImplementation> list = projectImplementationService.selectProjectImplementationList(projectImplementation);
        return getDataTable(list);
    }

    /**
     * 导出项目实施列表
     */
   // @PreAuthorize("@ss.hasPermi('brls:implementation:export')")
    @Log(title = "项目实施", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProjectImplementation projectImplementation)
    {
        List<ProjectImplementation> list = projectImplementationService.selectProjectImplementationList(projectImplementation);
        ExcelUtil<ProjectImplementation> util = new ExcelUtil<ProjectImplementation>(ProjectImplementation.class);
        util.exportExcel(response, list, "项目实施数据");
    }

    /**
     * 获取项目实施详细信息
     */
   // @PreAuthorize("@ss.hasPermi('brls:implementation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(projectImplementationService.selectProjectImplementationById(id));
    }

    /**
     * 新增项目实施
     */
    //@PreAuthorize("@ss.hasPermi('brls:implementation:add')")
    @Log(title = "项目实施", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProjectImplementation projectImplementation)
    {
        return toAjax(projectImplementationService.insertProjectImplementation(projectImplementation));
    }

    /**
     * 修改项目实施
     */
   // @PreAuthorize("@ss.hasPermi('brls:implementation:edit')")
    @Log(title = "项目实施", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProjectImplementation projectImplementation)
    {
        return toAjax(projectImplementationService.updateProjectImplementation(projectImplementation));
    }

    /**
     * 删除项目实施
     */
   // @PreAuthorize("@ss.hasPermi('brls:implementation:remove')")
    @Log(title = "项目实施", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(projectImplementationService.deleteProjectImplementationByIds(ids));
    }

    @PostMapping("/editProjectImplementation")
    public AjaxResult editProjectImplementation(@RequestBody ProjectProcessInfoDTO processInfoDTO) {
        return toAjax(projectImplementationService.editProjectImplementation(processInfoDTO));
    }
}
